{extend name="public/base"/}
{block name="body"}
<div class="main-box no-header clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>{$meta_title}（{$count}）</h2>
		</div>
		<div class="pull-right">

			 <button class="btn btn-primary ajax-post confirm" url="{:url('batchaccept')}" target-form="ids">接 单</button>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<div class="table-responsive">
      <table class="table table-striped table-hover">
        <thead>
          <tr>
            <th width="30"><input class="checkbox check-all" type="checkbox"></th>
            <th width="60">ID</th>
            <th>订单号</th>
            <th>用户名</th>
            <th>金额</th>
            <th>状态</th>
            <th>送货方式</th>
            <th>支付方式</th>
            <th>送货时间</th>
            <th>商家接单</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          {volist name="list" id="item"}
          <tr>
            <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$item['id']}"></td>
            <td>{$item['id']}</td>
            <td>{$item['out_trade_no']}</td>
            <td>{$item['user_name']} </td>
            <td>{$item['total']} </td>
            <td>{$item['buystatus']|parse_config_value='pay_status'}</td>
						<td>{$item['way']|parse_config_value='distribution'}</td>
						<td>{$item['pay']|parse_config_value='pay'} {eq name="$item.index_type" value="2"}(产地直发){/eq}</td>
						<td>{$item['group_time']} {$item['deliverytime']}</td>
						<td>
							{if condition="$item['accept_status'] eq 0 "} 未接单
							{elseif condition="$item['accept_status'] eq 1"/}已接单
							{else /} 已撤单
							{/if}
						</td>
            <td>
              <a href="{:url('edit',array('id'=>$item['id']))}">编辑</a>
							<!-- <a href="javascript:;" data-toggle="modal" data-target="#myModal" data-id="{$item['id']}" >接单</a> -->
              <!-- <a href="{:url('acceptOrder', ['id'=>$item['id']])}"  class="confirm ajax-get">接单</a> -->
							<a  href="javascript:;"  data-toggle="modal" data-target="#myModal" data-id="{$item['id']}">分配师傅</a>
            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
			{$list->render()}
			<!-- Modal -->
			<div class="modal fade "  id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
              <h4 class="modal-title" id="myModalLabel">分配师傅</h4>
            </div>
						<form class="form-horizontal" action="{:url('allot')}" method="post">
	            <div class="modal-body">
								{volist name=":getDeliveryPerson()" id="vo"}
									<label class="radio-inline">
									  <input type="radio" name="allot_person"  value="{$vo.id}"> {$vo.name}
									</label>
								{/volist}
								<input type="hidden" name="id" value="">
	            </div>
	            <div class="modal-footer">
	              <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	              <button type="submit" class="btn btn-primary submit-btn ajax-post"  target-form="form-horizontal">分配</button>
	            </div>
						</form>
          </div>
        </div>
      </div>
			<script>
			 $(function(){
				 $('#myModal').on('show.bs.modal', function (e) {
						var id = $(e.relatedTarget.outerHTML).attr('data-id');
						$(e.target).find('[name="id"]').val(id);
				 })
			 })
			</script>
		</div>
	</div>
</div>
{/block}
